//
//  BuyyerHeaderTableViewCell.m
//  SmartCoin
//
//  Created by apple on 2018/3/14.
//  Copyright © 2018年 Cynic. All rights reserved.
//

#import "BuyyerHeaderTableViewCell.h"

@implementation BuyyerHeaderTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
/**
 @property (nonatomic ,retain)UIButton *header;
 @property (nonatomic ,retain)UILabel *name;
 @property (nonatomic ,retain)UILabel *joblabel;
 @property (nonatomic ,retain)UILabel *idlabel;
 @property (nonatomic ,retain)UILabel *allMoney;
 @property (nonatomic ,retain)UILabel *outedMoney;
 @property (nonatomic ,retain)UILabel *canoutMoney
 */
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    
    UIView *BgBoxView = [[UIView alloc] initWithFrame:CGRectMake(15, 30, cx_wid - 30, 153)];
    BgBoxView.layer.cornerRadius = 4;
    BgBoxView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    BgBoxView.layer.shadowOffset = CGSizeMake(3, 3 );
    BgBoxView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:BgBoxView];
    
    _name = [[UILabel alloc] init];
//    _name.backgroundColor = [UIColor orangeColor];
    _name.bounds = CGRectMake(0, 0, cx_wid - 60, 24);
    _name.center = CGPointMake(cx_wid / 2, 71);
    _name.textAlignment = NSTextAlignmentCenter;
    _name.font = [UIFont systemFontOfSize:18];
    _name.textColor = [CXSinglerModel colorWithHex:@"4A4A4A" alpha:1];
    [self.contentView addSubview:_name];
    
    NSArray *infos = @[@[@"skill_color",@"--"],@[@"id",@"--"]];
    for (NSInteger index = 0; index < 2; index ++) {
        UIView *partview = [[UIView alloc]init];
        
        partview.bounds = CGRectMake(0, 0, 110, 20);
        partview.center = CGPointMake(cx_wid / 2 - 15 - 60 + 120 * index, 65);
        
        UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 20, 20)];
        [partview addSubview:icon];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 80, 20)];
        [partview addSubview:label];
        if (index == 0) {
            _joblabel = label;
        }
        else if (index == 1){
            _idlabel = label;
        }
        label.text = infos[index][1];
        icon.image = [UIImage imageNamed:infos[index][0]];
        label.textColor = [CXSinglerModel colorWithHex:@"#9B9B9B" alpha:1];
        label.font = [UIFont systemFontOfSize:14];
        [BgBoxView addSubview:partview];
    }
//        NSArray *colors = @[[UIColor orangeColor],[UIColor purpleColor],[UIColor cyanColor]];
        NSArray *dess = @[@"累计分红(元)",@"累计提现(元)",@"可提余额(元)"];
        for (NSInteger index = 0; index < 3; index ++) {
            UIView *partView = [[UIView alloc] initWithFrame:CGRectMake((cx_wid - 30) / 3 * index, 80, cx_wid / 3 - 10, 73)];
//            partView.backgroundColor = colors[index];
            UILabel *numberlabel = [[UILabel alloc] init];
            [partView addSubview:numberlabel];
            [numberlabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerX.mas_equalTo(partView.mas_centerX);
                make.top.mas_equalTo(partView.mas_top).with.mas_offset(18);
                make.size.mas_equalTo(CGSizeMake(cx_wid / 3 - 10, 20));
            }];
            
            UILabel *deslabel = [[UILabel alloc] init];
            [partView addSubview:deslabel];
            [deslabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerX.mas_equalTo(partView.mas_centerX);
                make.bottom.mas_equalTo(-8);
                make.size.mas_equalTo(CGSizeMake(cx_wid / 3 - 10, 20));
            }];
            deslabel.textAlignment = numberlabel.textAlignment = NSTextAlignmentCenter;
            deslabel.font = [UIFont systemFontOfSize:13];
            deslabel.text = dess[index];
            numberlabel.text = @"100.00";
            if (index == 0) {
                _allMoney = numberlabel;
            }
            else if (index == 1){
                _outedMoney = numberlabel;
            }
            else if (index == 2){
                _canoutMoney = numberlabel;
            }
            numberlabel.font = [UIFont systemFontOfSize:20];
            deslabel.textColor = [CXSinglerModel colorWithHex:@"999A9C" alpha:1];
            numberlabel.textColor = [UIColor blackColor];
            [BgBoxView addSubview:partView];
        }
        _header = [[UIButton alloc] init];
        _header.bounds = CGRectMake(0, 0, 60, 60);
        _header.center = CGPointMake(cx_wid / 2, 30);
        _header.layer.cornerRadius = 30;
        _header.backgroundColor = bggrayColor;
        _header.layer.borderWidth = 5;
    _header.clipsToBounds = YES;
        _header.layer.borderColor = [UIColor whiteColor].CGColor;
        [self.contentView addSubview:_header];
    
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
